package helloStruts.controller.actionClass;

import helloStruts.beans.User;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.util.profiling.UtilTimerStack;

@SuppressWarnings("serial")
public class RootAction extends ActionSupport implements Preparable{
	
	
	private User user; 
	private String str = "hello Struts !!!";
	
	
	
	
	/* -------------------- Struts Actions methods ----------------------------- */
	
	public String seloguer() {
		
		UtilTimerStack.setActive(true);
		
		if( user.getIdUser() == 1 && user.getName().equalsIgnoreCase("toto")) {
			return SUCCESS;
		} else {
			addActionMessage("Mauvaise identification");
			return INPUT;
		}
		
	}
	
	
	
	
	
	
	
	
	
	
	

	/**
	 * @return the str
	 */
	public String getStr() {
		return str;
	}

	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}












	public void prepare() throws Exception {
		UtilTimerStack.setActive(true);
	}
	
	
	
	
	
	
	

}
